package com.kx.kxpicture.model.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * 用户角色枚举
 *
 * @author kuangxin
 * date 2025/8/14
 */
@Getter
public enum UserRoleEnum {
    USER("用户","user"),
    ADMIN("管理员","admin");

    private final String text;
    private final String value;

    UserRoleEnum(String text,String value){
        this.text = text;
        this.value = value;
    }

    public static UserRoleEnum getEnum(String value){
        if(ObjectUtil.isEmpty(value)){
            return null;
        }
        for(UserRoleEnum roleEnum:values()){
            if(roleEnum.getValue().equals(value)){
                return roleEnum;
            }
        }
        return null;
    }
}
